﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OcmKeep.entity
{
    class StateBox : Panel
    {

        public Panel p;
        public Label l;
        public Color TextColor{
            set{
                l.ForeColor = value;
            }
            get{
                return l.ForeColor;
            }
        }
        public Font TextFont
        {
            set
            {
                l.Font = value;
            }
            get
            {
                return l.Font;
            }
        }
        public StateBox(int width){
            this.Width = width;
            l = new Label();
            l.MinimumSize = new Size(11,12);
            l.ForeColor = Color.FromArgb(240, 240, 240);
            l.Click += l_Click;
            this.Controls.Add(l);
        }

        void l_Click(object sender, EventArgs e)
        {
            this.InvokeOnClick(this, e);
        }

        public string addr{
            set {
                l.Text = value;
                if(value.Length==2)
                    l.Location = new Point(2, 0);
                else
                    l.Location = new Point(6, 0);
            }
            get {
                return l.Text;
            }
        }

        
    }
}
